import router from '@/router/index'

const whiteList = ['/login']
// 路由守卫，权限拦截，以及白名单放行
router.beforeEach((to, from, next) => {
  console.log('from', from, 'to:', to)
  if (whiteList.includes(to.path)) {
    // 白名单，放行
    next()
  } else {
    // 跳转到登录
    next('/login')
  }
})
